#pragma once
#include "PointLabCore/Entity.h"

#include "PointLabIO/Prerequisites.h"
#include "PointLabIO/Options.h"

namespace PointLabIO
{
	enum class POINTLAB_FILE_ERROR
	{
		POINTLAB_FILE_NO_ERROR,
		POINTLAB_FILE_BAD_ARGUMENT,
		POINTLAB_FILE_UNKNOWN_FILE,
		POINTLAB_FILE_WRONG_FILE_TYPE,
		POINTLAB_FILE_WRITING,
		POINTLAB_FILE_READING,
		POINTLAB_FILE_NO_SAVE,
		POINTLAB_FILE_NO_LOAD,
		POINTLAB_FILE_BAD_ENTITY_TYPE,
		POINTLAB_FILE_CANCELED_BY_USER,
		POINTLAB_FILE_NOT_ENOUGH_MEMORY,
		POINTLAB_FILE_MALFORMED_FILE,
		POINTLAB_FILE_CONSOLE_ERROR,
		POINTLAB_FILE_BROKEN_DEPENDENCY_ERROR,
		POINTLAB_FILE_FILE_WAS_WRITTEN_BY_UNKNOWN_PLUGIN,
		POINTLAB_FILE_THIRD_PARTY_LIB_FAILURE,
		POINTLAB_FILE_THIRD_PARTY_LIB_EXCEPTION,
		POINTLAB_FILE_NOT_IMPLEMENTED,
	};

	class POINTLABIO_EXPORT BaseIO
	{
	public:
		BaseIO();
		~BaseIO();

	public:
		virtual bool importSupported()const;
		virtual bool exportSupported()const;

		virtual PointLabIO::POINTLAB_FILE_ERROR loadFile(const std::string fileName, PointLabCore::Entity*& entity, PointLabIO::Options& options);
		virtual PointLabIO::POINTLAB_FILE_ERROR saveToFile(const std::string fileName, PointLabCore::Entity* entity, PointLabIO::Options& options);

		virtual std::string fileFilters()const = 0;
		virtual std::string defaultExtension()const = 0;

		virtual bool canLoadExtension(std::string upperCaseExt) const = 0;
		virtual bool canSave(PointLabCore::CLASS_TYPE type) const = 0;
	};
}
